package ReefStats::Schema::ReefStatsDB::UserRoles;

use warnings;
use strict;
use base 'DBIx::Class';
use ReefStats::Schema::DataTypes;

__PACKAGE__->load_components(qw/Core/);
__PACKAGE__->table('user_roles_');
__PACKAGE__->add_columns(
    user_id => { @_int, @_not_null },
    role_id => { @_int, @_not_null },
);
__PACKAGE__->set_primary_key(qw[user_id role_id]);

__PACKAGE__->belongs_to(
    user => 'ReefStats::Schema::ReefStatsDB::Users',
    { 'foreign.id'   => 'self.user_id' },
    { cascade_delete => 0 },
);

__PACKAGE__->belongs_to(
    role =>
      'ReefStats::Schema::ReefStatsDB::Roles',
    { 'foreign.id'   => 'self.role_id' },
    { cascade_delete => 0 },
);

1;

__END__
